using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Triton.Game;
using Triton.Game.Abstraction;
using Triton.Game.Mapping;

namespace ns28
{
	internal class Class278
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class Class279
		{
			public static readonly Class279 Instance9 = new Class279();

			internal Class278 method_0()
			{
				return new Class278();
			}
		}

		private static readonly PerFrameCachedValue<Class278> perFrameCachedValue_0 = new PerFrameCachedValue<Class278>(() => new Class278());

		private readonly Dictionary<IntPtr, Triton.Game.Abstraction.Card> dictionary_0 = new Dictionary<IntPtr, Triton.Game.Abstraction.Card>();

		private readonly Dictionary<IntPtr, Triton.Game.Abstraction.Entity> dictionary_1 = new Dictionary<IntPtr, Triton.Game.Abstraction.Entity>();

		private readonly Dictionary<IntPtr, Triton.Game.Abstraction.EntityDef> dictionary_2 = new Dictionary<IntPtr, Triton.Game.Abstraction.EntityDef>();

		private readonly Dictionary<IntPtr, Triton.Game.Abstraction.Actor> dictionary_3 = new Dictionary<IntPtr, Triton.Game.Abstraction.Actor>();

		private readonly Dictionary<IntPtr, Triton.Game.Abstraction.Player> dictionary_4 = new Dictionary<IntPtr, Triton.Game.Abstraction.Player>();

		public static Class278 Class278_0 => perFrameCachedValue_0;

		internal Triton.Game.Abstraction.Player method_0(Triton.Game.Mapping.Player player_0)
		{
			if (player_0 == null)
			{
				return null;
			}
			if (dictionary_4.TryGetValue(player_0.Address, out var value))
			{
				return value;
			}
			value = new Triton.Game.Abstraction.Player(player_0);
			dictionary_4.Add(player_0.Address, value);
			return value;
		}

		internal Triton.Game.Abstraction.Card method_1(Triton.Game.Mapping.Card card_0)
		{
			if (card_0 == null)
			{
				return null;
			}
			if (dictionary_0.TryGetValue(card_0.Address, out var value))
			{
				return value;
			}
			value = new Triton.Game.Abstraction.Card(card_0);
			dictionary_0.Add(card_0.Address, value);
			return value;
		}

		internal Triton.Game.Abstraction.Entity method_2(Triton.Game.Mapping.Entity entity_0)
		{
			if (entity_0 == null)
			{
				return null;
			}
			if (dictionary_1.TryGetValue(entity_0.Address, out var value))
			{
				return value;
			}
			value = new Triton.Game.Abstraction.Entity(entity_0);
			dictionary_1.Add(entity_0.Address, value);
			return value;
		}

		internal Triton.Game.Abstraction.EntityDef method_3(Triton.Game.Mapping.EntityDef entityDef_0)
		{
			if (entityDef_0 == null)
			{
				return null;
			}
			if (dictionary_2.TryGetValue(entityDef_0.Address, out var value))
			{
				return value;
			}
			value = new Triton.Game.Abstraction.EntityDef(entityDef_0);
			dictionary_2.Add(entityDef_0.Address, value);
			return value;
		}

		internal Triton.Game.Abstraction.Actor method_4(Triton.Game.Mapping.Actor actor_0)
		{
			if (actor_0 == null)
			{
				return null;
			}
			if (dictionary_3.TryGetValue(actor_0.Address, out var value))
			{
				return value;
			}
			value = new Triton.Game.Abstraction.Actor(actor_0);
			dictionary_3.Add(actor_0.Address, value);
			return value;
		}
	}
}
